package com.gm.wholesale.module.order.view.orderManger;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.gm.commonlib.module.image.ImageUtil;
import com.gm.commonlib.module.image.takeimage.ShowBigImagePopWindow;
import com.gm.wholesale.R;

public class OrderItemImagView extends LinearLayout {

    private ImageView imageView;
    private TextView deleteNtTv;

    private String mImagePath;

    public OrderItemImagView(Context context) {
        super(context);
        initView(context);
    }

    public OrderItemImagView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        initView(context);
    }

    private void initView(Context context){
        LayoutInflater.from(context).inflate(R.layout.view_order_item_image,this);
        imageView = findViewById(R.id.imageView);
        deleteNtTv = findViewById(R.id.deleteNtTv);
        setOnClickListener(v -> {
            ShowBigImagePopWindow showBigImagePopWindow=new ShowBigImagePopWindow(context);
            showBigImagePopWindow.showImage(mImagePath,v);
        });
    }

    public void showView(String path){
        mImagePath=path;
        ImageUtil.showImage(imageView,path);
    }

    public void showDeleteNtView(){
        deleteNtTv.setVisibility(View.VISIBLE);
    }
}
